NIELIT O Level Exam

Fill in the line of the following Python code for calculating the factorial of a number.

def fact(num):      if num == 0:           return 1      else:          return _____________________

Fill in the line of the following Python code for calculating the factorial of a number.

def fact(num):      if num == 0:           return 1      else:          return _____________________


किसी नंबर के फ़ैक्टोरियल की कॅल्क्युलेटिंग के लिए निम्नलिखित Python कोड की लाइन भरें।

A. num*fact(num-1)

B. (num-1)*(num-2)

C. num*(num-1)

D. fact(num)*fact(num-1)




Correct Answer is :

A. num*fact(num-1)



Explanation
Suppose n=5 then, 5*4*3*2*1 is returned which is the factorial of 5.
CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad